<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('admin_update');?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>编辑管理员</title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/jquery.nicescroll.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/layindex.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript">
    $(function () {
        //初始化表单验证
        $("#form").initValidform();
    });
</script>
</head>
<?php
$row = $dosql->GetOne("SELECT * FROM `#@__admin` WHERE `id`=$id");
?>
<body class="mainbody">
<form method="post" id="form" method="post" action="admin_save.php" >
<!--导航栏-->
<div class="location">
  <a href="admin.php" class="back"><i></i><span>返回列表页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <a href="admin.php"><span>管理员</span></a>
  <i class="arrow"></i>
  <span>编辑管理员</span>
   <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<div class="line10"></div>
<!--/导航栏-->

<!--内容-->
<div id="floatHead" class="content-tab-wrap">
  <div class="content-tab">
    <div class="content-tab-ul-wrap">
      <ul>
        <li><a class="selected" href="javascript:;">管理员信息</a></li>
      </ul>
    </div>
  </div>
</div>

<div class="tab-content">
  <dl>
    <dt>管理角色</dt>
    <dd>
      <div class="rule-single-select">
 <select name="levelname" id="levelname" datatype="*" errormsg="请选择管理员角色" sucmsg=" ">
		<?php
				$dosql->Execute("SELECT * FROM `#@__admingroup` WHERE `checkinfo`='true' ORDER BY `id` ASC");
				while($row2 = $dosql->GetArray())
				{

					if($row['levelname'] == $row2['id'])
						$selected = 'selected="selected"';
					else
						$selected = '';


					if($cfg_adminlevel == 1)
					{
						echo '<option value="'.$row2['id'].'" '.$selected.'>'.$row2['groupname'].'</option>';
					}
					else
					{
						if($row2['id'] >= $cfg_adminlevel)
							echo '<option value="'.$row2['id'].'" '.$selected.'>'.$row2['groupname'].'</option>';
					}
				}
				?>
</select>
      </div>
    </dd>
  </dl>
  <dl>
    <dt>是否启用</dt>
    <dd>
      <div class="rule-single-checkbox">
          <input id="checkadmin" type="checkbox" name="checkadmin" value="true" <?php if($row['checkadmin'] == 'true') echo 'checked="checked"'; ?> />
      </div>
      <span class="Validform_checktip">*不启用则无法使用该账户登录</span>
    </dd>
  </dl>
  <dl>
    <dt>用户名</dt>
    <dd><input  type="text" value="<?php echo $row['username']; ?>" readonly="readonly"  name="username" class="input normal" datatype="/^[a-zA-Z0-9\-\_]{2,50}$/" sucmsg=" " /> <span class="Validform_checktip">*字母、下划线，不可修改</span></dd>
  </dl> 
  <dl>
    <dt>旧密码</dt>
	<dd><input type="password" name="oldpwd" id="oldpwd" class="input  normal" maxlength="16" /> <span class="Validform_checktip">*若不修改密码请留空</span></dd>
  </dl>
  <dl>
    <dt>新密码</dt>
	<dd><input name="password" type="password" id="password" class="input normal" datatype="*6-20" nullmsg="请设置密码" errormsg="密码范围在6-20位之间" sucmsg=" " value="0|0|0|0" /> <span class="Validform_checktip">*登录的密码，至少6位</span></dd>
  </dl>
  <dl>
    <dt>确认密码</dt>
  <dd><input name="repassword" type="password" id="repassword" class="input normal" datatype="*" recheck="password" nullmsg="请再输入一次密码" errormsg="两次输入的密码不一致" sucmsg=" " value="0|0|0|0" /> <span class="Validform_checktip">*再次输入密码</span></dd>
  </dl> 
  <dl>
    <dt>提问</dt>
    <dd>
      <div class="rule-single-select">
 <select name="question" id="question" datatype="*" sucmsg=" ">
 <?php
				$question = array('无安全提问',
								  '母亲的名字',
								  '爷爷的名字',
								  '父亲出生的城市',
								  '你其中一位老师的名字',
								  '你个人计算机的型号',
								  '你最喜欢的餐馆名称',
								  '驾驶执照最后四位数字');

				foreach($question as $k=>$v)
				{
					if($row['question'] == $k)
						$selected = 'selected="selected"';
					else
						$selected = '';

					echo "<option value=\"$k\" $selected>$v</option>";									
				}
				?>
</select>
      </div>
    </dd>
  </dl>
   <dl>
    <dt>回答</dt>
    <dd><input type="text" name="answer" id="answer" class="input normal" value="<?php echo $row['answer']; ?>" /></dd>
  </dl>
  <dl>
    <dt>昵称</dt>
    <dd><input name="nickname" type="text" value="<?php echo $row['nickname']; ?>" id="txtRealName" class="input normal" /></dd>
  </dl>
	<dl>
    <dt>登录时间</dt>
    <dd><?php echo GetDateTime($row['logintime']); ?></dd>
  </dl>
  <dl>
    <dt>登录ip</dt>
    <dd><?php echo $row['loginip']; ?></dd>
  </dl>
</div>
<!--/内容-->

<!--工具栏-->
<div class="page-footer">
  <div class="btn-wrap">
    <input type="submit" name="btnSubmit" value="提交保存" class="btn" />
    <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
	<input type="hidden" name="action" id="action" value="update" />
	<input type="hidden" name="id" id="id" value="<?php echo $id; ?>" />
  </div>
</div>
<!--/工具栏-->
</form>
</body>
</html>
